//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using OpenLS.Spreadsheet.Expressions;

namespace OpenLS.Spreadsheet.Parsing
{
    class MultiWorksheetRangeFactory : RangeFactory
    {

        private List<Worksheet> _worksheets;

        public MultiWorksheetRangeFactory(IEnumerable<Worksheet> worksheets, Worksheet caller)
            : base(caller)
        {
            this._worksheets = Enumerable.ToList(worksheets);
        }

        public override Worksheet Worksheet
        {
            get { throw new NotImplementedException(); }
        }

        protected override RangeReference GetRangeReferenceImp(RangeReferenceInfo info)
    
  
        {
            throw new NotImplementedException();
        }

        public override Expression GetCellReferenceExpression(CellReferenceToken token)
        {
            return new MultiSheetCellReferenceExpression(this._worksheets, token);
        }

        public override CellEnumeratorExpression GetAnyReferenceExpression(ReferenceToken token)
        {
            if (token is CellReferenceToken)
            {
                CellReferenceToken t = (CellReferenceToken) token;

                return new MultiSheetCellReferenceExpression(this._worksheets, t);
            }
            throw new NotImplementedException();
        }

        public  CellEnumeratorExpression GetAnyReferenceExpression(CellReferenceToken token)
        {
            throw new NotImplementedException();
        }

        public override Expression GetRangeReferenceExpression(List<ReferenceToken> tokens)
        {
            return new MultiSheetRangeReferenceExpression(this._worksheets, tokens);
        }

        internal override RangeReference GetRangeReference(ReferenceToken token)
        {
            throw new NotImplementedException();
        }
    }
}